import hashlib

import pyhash
from farmhash import FarmHash128


def md5(data: bytes) -> bytes:
    h = hashlib.md5()
    h.update(data)
    return h.digest()


def farm64(data: bytes) -> bytes:
    hasher = pyhash.farm_64()
    return hasher(data).to_bytes(8, 'big')


def murmur2_64(data: bytes) -> bytes:
    hasher = pyhash.murmur2_x64_64a()
    return hasher(data).to_bytes(8, 'big')


def farm128(data: bytes) -> bytes:
    return FarmHash128(data).to_bytes(16, 'big')


def t1ha0_64(data: bytes) -> bytes:
    hasher = pyhash.t1ha0_64()
    return hasher(data).to_bytes(8, 'big')
